var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {
    value: !0
});
var i = t("GlobalUserData"),
n = t("BoxGetView"),
a = t("HallScene"),
r = t("Util"),
s = t("WXSDK"),
l = t("Particle"),
c = t("Global"),
d = function() {
    function t() {}
    return t.receiveAward = function(t, e) {
        var o, r = t.Sprite.spriteFrame;
        switch (t.Tag) {
            case c.BonusType.Coin:
                i.default.saveGoldData(!0, t.Value),
            s.default.getIntance().expt_GetGold(t.Value),
            this.action(r, this.getEndPosOfNode(c.BonusType.Coin), t.node, e),
            cc.find("Canvas").getComponent(a.default).onSetOwnGold(!0);
            break;
            case c.BonusType.Diamond:
                i.default.saveDiamondData(!0, t.Value),
            s.default.getIntance().expt_GetDiamond(t.Value),
            this.action(r, this.getEndPosOfNode(c.BonusType.Diamond), t.node, e),
            cc.find("Canvas").getComponent(a.default).onSetOwnDiamond(!0);
            break;
            case c.BonusType.Box_common:
                o = cc.instantiate(e),
            cc.find("Canvas").addChild(o, 100),
            o.getComponent(n.default).showOpenBoxView(n.Box_Type.common, cc.find("Canvas").getComponent(a.default));
            break;
            case c.BonusType.Box_middle:
                o = cc.instantiate(e),
            cc.find("Canvas").addChild(o, 100),
            o.getComponent(n.default).showOpenBoxView(n.Box_Type.middle, cc.find("Canvas").getComponent(a.default));
            break;
            case c.BonusType.Box_senior:
                o = cc.instantiate(e),
            cc.find("Canvas").addChild(o, 100),
            o.getComponent(n.default).showOpenBoxView(n.Box_Type.senior, cc.find("Canvas").getComponent(a.default));
            break;
            default: cc.log("指令错误");
        }
    },
    t.prototype.unpack = function(t, e) {
        var o = cc.instantiate(t);
        cc.find("Canvas").addChild(o, 100),
        o.getComponent(n.default).showOpenBoxView(e, cc.find("Canvas").getComponent(a.default))
    },
    t.getEndPosOfNode = function(t) {
        var e;
        switch (t) {
            case c.BonusType.Coin:
                e = cc.find("Canvas").getChildByName("frame_gold");
            break;
            case c.BonusType.Diamond:
                e = cc.find("Canvas").getChildByName("frame_diamond");
            break;
            case c.BonusType.RedConsume:
                e = cc.find("Canvas").getChildByName("frame_consume").getChildByName("red");
            break;
            case c.BonusType.GoldenConsume:
                e = cc.find("Canvas").getChildByName("frame_consume").getChildByName("golden");
            break;
            case c.BonusType.PurpleConsume:
                e = cc.find("Canvas").getChildByName("frame_consume").getChildByName("purple");
            break;
            case c.BonusType.BlueConsume:
                e = cc.find("Canvas").getChildByName("frame_consume").getChildByName("blue");
            break;
            case c.BonusType.GreenConsume:
                e = cc.find("Canvas").getChildByName("frame_consume").getChildByName("green");
        }
        return e
    },
    t.action = function(t, e, o, i) {
        for (var n = cc.find("Canvas"), a = 0; a < 20; a++) {
            var s = cc.instantiate(i),
            c = e.convertToWorldSpaceAR(cc.Vec2.ZERO),
            d = n.convertToNodeSpaceAR(c),
            h = o.convertToWorldSpaceAR(cc.Vec2.ZERO),
            p = n.convertToNodeSpaceAR(h);
            s.parent = n,
            s.setPosition(p),
            s.getComponent(l.default).init(r.Util.getRandomInt(0, 360), r.Util.getRandomInt(200, 400), d, t)
        }
    },
    t
} ();
o.default = d